using System.Collections;
using Wilco.SyntaxHighlighting.Engine.Node;

namespace Wilco.SyntaxHighlighting.Engine.Node
{
    /// <summary>
    /// Represents a collection of nodes.
    /// </summary>
    public class NodeCollection : CollectionBase
    {
        /// <summary>
        /// Initializes a new instance of a <see cref="NodeCollection"/> class.
        /// </summary>
        public NodeCollection()
        {
            //
        }

        /// <summary>
        /// Gets an <see cref="INode"/> object at the specified index.
        /// </summary>
        public INode this[int index]
        {
            get
            {
                return (INode)List[index];
            }
        }

        /// <summary>
        /// Adds a node.
        /// </summary>
        /// <param name="node">An <see cref="INode"/> object.</param>
        /// <returns>Index of the added object.</returns>
        public int Add(INode node)
        {
            return List.Add(node);
        }

        /// <summary>
        /// Removes a node.
        /// </summary>
        /// <param name="node">An <see cref="INode"/> object.</param>
        public void Remove(INode node)
        {
            List.Remove(node);
        }
    }
}